<?php
/**
 *  💡 免责声明：本软件不得用于商业用途，仅做学习交流
 *  ⚠️ 权利声明：本软件由版权人提供产品技术支持
 *  📅 项目编号：NX2025-0135
 */
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

class CreateUsersTable extends Migration
{
    /**
     * Run the migrations.
     */
    public function up()
    {
        Schema::create('users', function (Blueprint $table) {
            $table->id();
            $table->string('name')->default('新用户')->comment('姓名');
            $table->string('telephone')->unique()->comment('电话');
            $table->string('password')->comment('密码');
            $table->string('transaction_password')->comment('交易密码');
            $table->string('profile')->comment('头像');
            $table->unsignedBigInteger('default_bank_card_id')->default(0)->comment('默认提现银行卡账户');
            $table->unsignedInteger('parent')->default(0)->comment('父级');
            $table->tinyInteger('member_level')->default(0)->comment('会员拼单等级');
            $table->tinyInteger('agent_level')->default(0)->comment('代理商等级');
            $table->tinyInteger('status')->default(1)->comment('用户状态');
            $table->string('uuid')->nullable()->comment('邀请码');
            $table->timestamps();
        });
        \Illuminate\Support\Facades\DB::statement("ALTER TABLE `users` comment '用户表'");
    }

    /**
     * Reverse the migrations.
     */
    public function down()
    {
        Schema::dropIfExists('users');
    }
}
